import { GBox } from "../../../../../com/mui/containers/GBox";
import { ChatNotes } from "./ChatNotes";
import { GBoxDirection } from "../../../../../com/mui/containers/globalVariable/GBoxDirection";
import { Vector } from "../../../../../__AS3__/vec/Vector";
type int = number;
//class ChatBox
    
    export  class ChatBox extends GBox
    {
        constructor(arg1: int=30)
        {
            super();
            this._maxItem = arg1;
            this._itemVector = new Vector.<ChatNotes>();
            this.mouseEnabled = false;
            super.direction = GBoxDirection.VERTICAL;
            super.verticalGap = 0;
            return;
        }

        public addChatNotes(arg1: ChatNotes): void
        {
            this.addChild(arg1);
            this.validateNow();
            this.updateDisplayList();
            this._itemVector.push(arg1);
            if (this._itemVector.length > this._maxItem) 
            {
                arg1 = this._itemVector.shift();
                this.removeChild(arg1);
                arg1.dispose();
            }
            this._lastChatNotes = arg1;
            this.validateNow();
            this.updateDisplayList();
            return;
        }

        public get currentLength(): int
        {
            return this._itemVector.length;
        }

        public isMaxLength(): Boolean
        {
            return this._itemVector.length == this._maxItem;
        }

        public getChatNotesAtIndex(arg1: int): ChatNotes
        {
            return this._itemVector[arg1];
        }

        public /* override */ get height(): number
        {
            var loc4=null;
            var loc5=0;
            var loc1=0;
            var loc2=0;
            var loc3=numChildren;
            while (loc2 < loc3) 
            {
                loc4 = getChildAt(loc2) as Object /* flash.display.DisplayObject */;
                loc1 = loc1 + loc4.height;
                ++loc2;
            }
            return loc1 + verticalGap * (this._itemVector.length - 1) + 5;
        }

        public reset(): void
        {
            this._itemVector = new Vector.<ChatNotes>();
            var loc1=(this.numChildren - 1);
            while (loc1 >= 0) 
            {
                this.removeChildAt(loc1);
                --loc1;
            }
            return;
        }

        /* internal */ /* var */_itemVector: Vector.<ChatNotes>;

        /* internal */ /* var */_maxItem: int;

        /* internal */ /* var */_lastChatNotes: ChatNotes=null;
    }
